package com.zdb.demo.design.pattern.behavioral.iterator.demo1;

public class Test {
    public static void main(String[] args) {

        Course c1 = new Course("c1");
        Course c2 = new Course("c2");
        Course c3 = new Course("c3");
        Course c4 = new Course("c4");
        Course c5 = new Course("c5");

        CourseAggregate  courseAggregate = new CourseAggregateImpl();
        courseAggregate.addCourse(c1);
        courseAggregate.addCourse(c2);
        courseAggregate.addCourse(c3);
        courseAggregate.addCourse(c4);
        courseAggregate.addCourse(c5);

        CourseIterator courseIterator = courseAggregate.courseIterator();
        while(!courseIterator.lastCourse()) {
            System.out.println(courseIterator.nextCourse());
        }
    }
}
